package com.yjy.exception;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 自定义异常
 * 运行时异常
 */
@Data //getter setter toString
@AllArgsConstructor
@NoArgsConstructor
public class CustomerException extends RuntimeException{
    private String code;
    private String msg;

    public CustomerException(String msg) {
        this.code = "500";
        this.msg = msg;
    }

}

//@Data
//@AllArgsConstructor
//@Builder
//public class CustomerException extends RuntimeException {
//    private final ErrorCode code;  // 枚举类型
//    private final String message;
//    private final Throwable cause;
//
//    // 常用构造器（仅 message）
//    public CustomerException(String message) {
//        this(ErrorCode.UNKNOWN, message, null);
//    }
//}
//
//// 错误码枚举
//enum ErrorCode {
//    UNKNOWN("500"),
//    NOT_FOUND("404");
//
//    private final String code;
//    ErrorCode(String code) { this.code = code; }
//}
